<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
  $(function() {

    $("#searchbtn").click(function() {
      var search = $("#search").val();
      $("#search").attr('value', search);
      location.href = "notice_search.do?search=" + search;
    });
  });
</script>
<div id="content_work">
  <!-- 컨텐츠 -->
  <div class="work_contents3">
    <h1><img src="images/recruit/admin/notice.gif" alt="공지사항"></h1>
    <br>
    <table width="710">
      <tr> 
        <td>
          <select name="type" id="type" id="cboRecruit" 
            style="height: 23px; border: 1px solid #320c43; z-index: 20; background-color: #FAF7FF; width: 60px;">
              <option value="title">제목</option>
          </select>
          <input type="text" id="search" name="search" 
                 style="height: 21px; border: 1px solid #320c43; z-index: 20; background-color: #FAF7FF; value="">
          <input type="button" id="searchbtn" value="검색" 
                 style="height: 23px; border: 1px solid #320c43; z-index: 20; background-color: #FAF7FF;
                 padding: 0 10px 0 8px; line-height: 23px;">
        </td>
        <td align="right">
          <a href="admin_notice_form.do">
            <button style="height: 23px; border: 1px solid #320c43; z-index: 20; background-color: #FAF7FF;
                    padding: 0 10px 0 8px; line-height: 23px;">글쓰기</button>
          </a>
        </td>
      </tr>
    </table>   
    <table class="tbl_type ma_b25 ma_t27" border="0" cellspacing="0" cellpadding="0">
      <colgroup>
        <col width="75px">
        <col width="">
        <col width="150px">
      </colgroup>
      <thead>
        <tr>
          <th>순번</th>
          <th>제목</th>
          <th>일자</th>
        </tr>
      </thead>
      <tbody>
        <c:forEach var="list" items="${list }">
          <tr>
            <td class="td_t_bo td_b_bo td_l_bo2">${list.notice_num }</td>
             <c:choose>
                <c:when test="${fn:length(list.notice_nm) > 50}">
                     <td class="td_t_bo td_b_bo al_l pd_l10">
                      <a href="admin_notice_detail.do?notice_num=${list.notice_num }">
                        <c:out value="${fn:substring(list.notice_nm,0,49)}" />...</a>
                     </td>
                </c:when>
                <c:otherwise>
                     <td class="td_t_bo td_b_bo al_l pd_l10">
                        <a href="admin_notice_detail.do?notice_num=${list.notice_num }">
                          <c:out value="${list.notice_nm}" /></a>
                     </td>
                </c:otherwise>
            </c:choose>
           
            <td class="td_t_bo td_b_bo">${list.reg_dt }</td>
          </tr>
        </c:forEach>
      </tbody>
    </table>
    <table width="710">
      <tr>
        <td align="center">
          <!-- 처음 이전 링크 --> <c:if test="${map.pg!=1}">  
         [<a href="admin_notice_list.do?pg=1">◀◀</a>]
         [<a href="admin_notice_list.do?pg=${map.pg-1}">◀</a>]      
      </c:if> <!-- 블록 범위 찍기 --> <c:forEach begin="${map.fromPage}" end="${map.toPage}" var="i">
            <c:if test="${i==map.pg}">[${i}]</c:if>
            <c:if test="${i!=map.pg}">
            [<a href="admin_notice_list.do?pg=${i}">${i}</a>]
         </c:if>
          </c:forEach> <!-- 다음, 이후 --> <c:if test="${map.pg!=map.allPage}">  
         [<a href="admin_notice_list.do?pg=${map.toPage}">▶▶</a>]
         [<a href="admin_notice_list.do?pg=${map.pg+1}">▶</a>]      
      </c:if>
        </td>
      </tr>
    </table>
  </div>
  <!-- 컨텐츠 -->
  </div>